package com.account.book.controller;

import com.account.book.common.context.UserTokenContextHolder;
import com.account.book.common.response.BaseResult;
import com.account.book.common.response.ResultUtils;
import com.account.book.entity.Book;
import com.account.book.mapper.BookMapper;
import com.account.book.response.ApprovalInfoResVo;
import com.account.book.service.ApprovalInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author liang-hw
 * @className ApprovalInfoController
 * @description 账本审批信息
 * @date 2024/01/20 16:58:24
 */
@Api(tags = {"账本审批信息"})
@RestController
@RequestMapping("/api/approval")
public class ApprovalInfoController {
    @Autowired
    private ApprovalInfoService approvalInfoService;

    /**
     * @param
     * @return @return {@link BaseResult }
     * @author liang-hw
     * @description 查询账本审批信息
     * @date 2024/01/20 17:01:03
     */
    @ApiOperation(value = "查询账本审批信息", notes = "查询账本审批信息")
    @PostMapping("/selectApprovalInfo")
    public BaseResult selectApprovalInfo() {
        // 获取用户id
        String userId = UserTokenContextHolder.getUserTokenVOByToken().getUserId();
        List<ApprovalInfoResVo> approvalInfoResVos = approvalInfoService.selectApprovalInfo(userId);
        return ResultUtils.success(approvalInfoResVos);
    }
}
